Add Beholder default metric filter views#2238
Conversation
✅ API Diff Results -
|
9eaf479 to
a7dbabb
Compare
ee3c5d6 to
ed2bce5
Compare
1215879 to
a0f879f
Compare
49139a9 to
ff6c540
Compare
| MetricViewsDisabled bool | ||
| // MetricViewsAttributeBlacklist lists attribute keys dropped by the default | ||
| // global deny view (e.g. event_id). Empty means no keys are stripped. | ||
| MetricViewsAttributeBlacklist []string |
There was a problem hiding this comment.
ubiquitous language -
| MetricViewsAttributeBlacklist []string | |
| MetricViewsAttributeDenylist []string |
There was a problem hiding this comment.
Renamed to MetricViewsAttributeDenylist / CL_TELEMETRY_METRIC_VIEWS_ATTRIBUTE_DENYLIST.
| MetricViews []metric.View | ||
| // MetricViewsDisabled skips metricviews.DefaultViews() attribute filtering. | ||
| // Caller-supplied MetricViews are still applied. Set via CL_TELEMETRY_METRIC_VIEWS_DISABLED. | ||
| MetricViewsDisabled bool |
There was a problem hiding this comment.
This is an indirect way to accomplish "skips metricviews.DefaultViews() attribute filtering." could we make this a configurable func instead?
There was a problem hiding this comment.
Removed MetricViewsDisabled. metricViews() now skips DefaultViews() when len(MetricViewsAttributeDenylist) == 0.
| if cfg.MetricViewsDisabled { | ||
| return cfg.MetricViews | ||
| } | ||
| return append(cfg.MetricViews, metricviews.DefaultViews(cfg.MetricViewsAttributeBlacklist)...) |
There was a problem hiding this comment.
what layer actually enforces the blacklist?
There was a problem hiding this comment.
OTel sdk enforces the filtering internally when views are applied.
This view works as a blacklist https://github.com/smartcontractkit/chainlink-common/pull/2238/changes#diff-789107496fd41dc58076e2b01a4ce4276dfa4f624fb12afe4d6c477895c8299bR35-R39
The label black list is passed from the core config
https://github.com/smartcontractkit/chainlink/pull/23085/changes#diff-04e1ccf045f3755e62cafdc05a7e035be4293871790f5a186a0d8dda8a22a5c0R913
f9ad01a to
c2bb0f6
Compare
Introduce metricviews.DefaultViews() with an empty denylist by default, Config.metricViews/metricOptions methods, and CL_TELEMETRY_METRIC_VIEWS_DISABLED wiring through loop env and server. Caller views precede defaults so histogram-bucket overrides are not shadowed. Co-authored-by: Cursor <cursoragent@cursor.com>
Expose MetricViewsAttributeBlacklist on beholder.Config and wire CL_TELEMETRY_METRIC_VIEWS_ATTRIBUTE_BLACKLIST through loop env and server. DefaultViews builds a global deny view when keys are configured. # Conflicts: # pkg/loop/config_test.go
Wire MetricViewsAttributeBlacklist through beholder.Config and CL_TELEMETRY_METRIC_VIEWS_ATTRIBUTE_BLACKLIST via loop env/server. DefaultViews(blacklist) registers a global deny view when non-empty; empty by default so no attributes are stripped until configured. # Conflicts: # pkg/loop/config_test.go
Empty MetricViewsAttributeDenylist skips DefaultViews() instead of a separate disabled flag. Env var is CL_TELEMETRY_METRIC_VIEWS_ATTRIBUTE_DENYLIST. Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # pkg/loop/config_test.go
c2bb0f6 to
c0e49ea
Compare
Summary
pkg/beholder/metricviewswith deny-onlyDefaultViews(blacklist)— empty blacklist by default (no attributes stripped until configured).MetricViewsAttributeBlacklistonbeholder.Config, wired viaCL_TELEMETRY_METRIC_VIEWS_ATTRIBUTE_BLACKLIST(comma-separated) through loopEnvConfigandserver.go.Config.metricViews()and zero-argConfig.metricOptions(); caller views precede defaults so histogram-bucket overrides are not shadowed.CL_TELEMETRY_METRIC_VIEWS_DISABLEDas an emergency disable flag.Stacks on #2225 (cardinality limit). Merge limit PR first, then rebase this onto
main.Test plan
go test ./pkg/beholder/... ./pkg/loop